package EnmuDemo;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

/**
 * @Author: Lenovo
 * @Date: 2024/8/8 13:00
 * @description:
 */
public class Test {
    public static void main(String[] args) {
        try {
            Class<?> c1 = Class.forName("EnmuDemo.TestEnum");
            Constructor<TestEnum> constructor =
                    (Constructor<TestEnum>) c1.getDeclaredConstructor(int.class,String.class);
            constructor.setAccessible(true);
            TestEnum testEnum = constructor.newInstance(9,"White");
            System.out.println(testEnum);
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        } catch (NoSuchMethodException e) {
            throw new RuntimeException(e);
        } catch (InvocationTargetException e) {
            throw new RuntimeException(e);
        } catch (InstantiationException e) {
            throw new RuntimeException(e);
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
        }

    }
}
